class QueryData {
  constructor(queryString = '', queryElementId = '') {
    this.queryString = queryString;
    this.queryElementId = queryElementId;
    this.queryMap = {};
  }
  getTrueQueryString() {
    const queryValue = document.getElementById(this.queryElementId).value;
    const terms = (queryValue).split(/\s+/);
    terms.forEach((term, index)=> {
      if (term === '=' || term === '>' || term === '<' || term === '>=' || term === '<=' ||
      term === 'in' || term === 'like' || term === '!=' || term === 'not') {
        const termPre = terms[index - 1];
        const newTerm = this.queryMap[termPre];
        if (newTerm !== undefined && newTerm !== null) {
          terms[index - 1] = newTerm;
        }
      }
    });
    const result = terms.join(' ');
    this.queryString = queryValue;
    return result;
  }
}
export {
  QueryData
};